/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

constexpr int maxn = 2e5 + 2;

int a[maxn], b[maxn];

int val[maxn * 4];

void push_up(int cur) { val[cur] = std::max(val[cur << 1], val[cur << 1 | 1]); }

void build(int cur, int l, int r) {
  if (l == r) {
    val[cur] = b[l];
    return;
  }
  int ls = cur << 1, rs = cur << 1 | 1, mid = (l + r) >> 1;
  build(ls, l, mid);
  build(rs, mid + 1, r);
  push_up(cur);
}

int query(int cur, int l, int r, int L, int R) {
  if (L <= l && r <= R) return val[cur];
  int mid = (l + r) >> 1;
  int res = 0;
  if (L <= mid) res = std::max(res, query(cur << 1, l, mid, L, R));
  if (mid < R) res = std::max(res, query(cur << 1 | 1, mid + 1, r, L, R));
  return res;
}

void solve() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  std::map<int, std::vector<int>> hair;
  for (int i = 1; i <= n; ++i) {
    cin >> b[i];
    if (b[i] < a[i]) hair[b[i]].push_back(i);
  }
  int m;
  cin >> m;
  std::map<int, int> razor;
  for (int i = 1; i <= m; ++i) {
    int x;
    cin >> x;
    razor[x]++;
  }
  for (int i = 1; i <= n; ++i) {
    if (b[i] > a[i]) {
      cout << "NO\n";
      return;
    }
  }
  build(1, 1, n);
  for (auto i = hair.begin(); i != hair.end(); ++i) {
    auto &vec = i->second;
    int cnt = 1;
    for (auto j = vec.begin() + 1; j != vec.end(); ++j) {
      if (query(1, 1, n, *(j - 1), *j) > i->first) ++cnt;
    }
    if (cnt > razor[i->first]) {
      cout << "NO\n";
      return;
    }
  }
  cout << "YES\n";
}

int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("D. Boris and His Amazing Haircut.in", "r", stdin);
  freopen("D. Boris and His Amazing Haircut.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
